package org.acra;

import android.content.Context;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.acra.sender.d;
import org.acra.sender.e;

final class aa extends Thread
{
  private final Context a;
  private final boolean b;
  private final boolean c;
  private final i d = new i();
  private final List e;

  public aa(Context paramContext, List paramList, boolean paramBoolean1, boolean paramBoolean2)
  {
    this.a = paramContext;
    this.e = paramList;
    this.b = paramBoolean1;
    this.c = paramBoolean2;
  }

  private void a()
  {
    Log.d(ACRA.LOG_TAG, "Mark all pending reports as approved.");
    for (String str1 : new j(this.a).a())
      if (!this.d.b(str1))
      {
        File localFile1 = new File(this.a.getFilesDir(), str1);
        String str2 = str1.replace(".stacktrace", "-approved.stacktrace");
        File localFile2 = new File(this.a.getFilesDir(), str2);
        if (!localFile1.renameTo(localFile2))
          Log.e(ACRA.LOG_TAG, "Could not rename approved report from " + localFile1 + " to " + localFile2);
      }
  }

  private void a(Context paramContext, String paramString)
  {
    if (!paramContext.deleteFile(paramString))
      Log.w(ACRA.LOG_TAG, "Could not delete error report : " + paramString);
  }

  private void a(Context paramContext, boolean paramBoolean)
  {
    int i = 0;
    Log.d(ACRA.LOG_TAG, "#checkAndSendReports - start");
    String[] arrayOfString = new j(paramContext).a();
    Arrays.sort(arrayOfString);
    int j = arrayOfString.length;
    int k = 0;
    String str;
    while (k < j)
    {
      str = arrayOfString[k];
      if ((paramBoolean) && (!this.d.a(str)))
        k++;
      else
        if (i < 5)
          break label88;
    }
    while (true)
      while (true)
      {
        Log.d(ACRA.LOG_TAG, "#checkAndSendReports - finish");
        return;
        label88: Log.i(ACRA.LOG_TAG, "Sending file " + str);
        try
        {
          a(new l(paramContext).a(str));
          a(paramContext, str);
          i++;
        }
        catch (RuntimeException localRuntimeException)
        {
          Log.e(ACRA.LOG_TAG, "Failed to send crash reports for " + str, localRuntimeException);
          a(paramContext, str);
        }
        catch (IOException localIOException)
        {
          Log.e(ACRA.LOG_TAG, "Failed to load crash report for " + str, localIOException);
          a(paramContext, str);
        }
        catch (e locale)
        {
          Log.e(ACRA.LOG_TAG, "Failed to send crash report for " + str, locale);
        }
      }
  }

  private void a(org.acra.b.c paramc)
  {
    if ((!ACRA.isDebuggable()) || (ACRA.getConfig().G()))
    {
      Iterator localIterator = this.e.iterator();
      int i = 0;
      while (true)
        if (localIterator.hasNext())
        {
          d locald = (d)localIterator.next();
          try
          {
            locald.a(paramc);
            j = 1;
            i = j;
          }
          catch (e locale)
          {
            while (true)
            {
              if (i == 0)
                throw locale;
              Log.w(ACRA.LOG_TAG, "ReportSender of class " + locald.getClass().getName() + " failed but other senders completed their task. ACRA will not send this report again.");
              int j = i;
            }
          }
        }
    }
  }

  public void run()
  {
    if (this.c)
      a();
    a(this.a, this.b);
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     org.acra.aa
 * JD-Core Version:    0.6.2
 */